package com.bdqn.Short.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping(value = "/hello")
public class HelloController {

    @RequestMapping(value = "add")
    public String add(){

        return "index";
    }

    @RequestMapping(value = "insert")
    public ModelAndView insert(@RequestParam(required = false) String realName,String age) throws Exception{
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.addObject("realName",realName);
        modelAndView.addObject("age",age);
        modelAndView.setViewName("hello2");
        return modelAndView;
    }
}
